<template>
  <div class="component-container">
    <ul class="new-book-list-container">
      <li class="new-book-row" v-for="(item,index) in newBookListData" :key="index">
        <div class="new-book-item" v-for="(items,indexs) in item" :key="indexs">
          <div class="new-book-bg">
            <div class="img-book-container">
              <img src="@/assets/image/book1.png" alt />
            </div>
            <div class="new-book-text-content">
              <h1 class="new-book-text-content-title">共建“一带一路”</h1>
              <ul class="new-book-text-list">
                <li>
                  <h3 class="title">作者</h3>
                  <h3>裴长洪</h3>
                </li>
                <li>
                  <h3 class="title">ISBN</h3>
                  <h3>983-3</h3>
                </li>
                <li>
                  <h3 class="title">市场价格</h3>
                  <h3>99元</h3>
                </li>
                <li>
                  <h3 class="title">出版社</h3>
                  <h3>xxx</h3>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: "newBookList",
  data() {
    return {
      // newBookListData:[]
    };
  },
  computed: {
    newBookListData() {
      let result = [];
      for (let i = 0; i < this.newBookData.length; i += 3) {
        let itemList = [];
        for (let j = 1; j <= 3; j++) {
          itemList.push(this.newBookData[i + j]);
        }
        result.push(itemList);
      }
      return result;
    }
  },
  props: {
    newBookData: {
      type: Array,
      default: () => [
        { id: 1 },
        { id: 1 },
        { id: 1 },
        { id: 1 },
        { id: 1 },
        { id: 1 },
        { id: 1 }
      ]
      //   required: true
    }
  }
};
</script>
<style lang="scss" scoped>
.component-container {
  width: 100%;
  .new-book-list-container {
    .new-book-row {
      background: #fff;
      width: 100%;
      display: flex;
      .new-book-item:first-child .new-book-item .new-book-bg {
        border-left: 0;
      }
      .new-book-item:last-child .new-book-item .new-book-bg {
        border-left: 0;
      }
      .new-book-item {
        height: 310px;
        width: 100%;
        .new-book-bg:hover {
          background: #4e8cdb;
          .new-book-text-list li h3 {
            color: #fff;
          }
        }
        .new-book-bg {
          transition: all 1s;
          padding-top: 50px;
          padding-left: 70px;
          background: #bebfc0;
          height: 200px;
          border: 1px solid #fff;
          display: flex;
          .img-book-container {
            padding-right: 20px;
            img {
              height: 250px;
            }
          }
          .new-book-text-content {
            width: 100%;
            .new-book-text-content-title {
              padding-bottom: 16px;
              font-size: 19px;
              color: #333;
              font-weight: normal;
            }
            .new-book-text-list li {
              display: flex;
              h3 {
                transform: all 1s;
                font-size: 16px;
                font-weight: normal;
                line-height: 30px;
                width: 100%;
              }
              .title {
                width: 150px;
                // color:#333;
                text-align: justify;
              }
            }
          }
        }
      }
    }
  }
}
</style>